#ifndef __LINKSTACK_H_
#define __LINKSTACK_H_
#include "DoubleLinkList.hpp"

template<typename T>
class LinkStack:protected DoubleLinkList<T>
{
public:
    LinkStack():DoubleLinkList<T>(){};

    ~LinkStack(){}

    void Push(const T &element)
    {
        DoubleLinkList<T>::InsertTail(element);
    }

    void Pop()
    {
        DoubleLinkList<T>::RemoveByIndex(DoubleLinkList<T>::Size()-1);
    }

    T &GetTop()
    {
        // return DoubleLinkList<T>::GetHead2(this->Size() - 1);
        return DoubleLinkList<T>::GetTail();

    }

    size_t Size()
    {
        return DoubleLinkList<T>::Size();
    }

    bool IsEmpty()
    {
        return this->Size() == 0;
    }

protected:
    // DoubleLinkList<T>;
};


#endif